home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 October: Mac OS SDK / Dev.CD Oct 00 SDK1.toast / Development Kits / Cross Platform / QuickTime 4.1.2 Windows SDK / CIncludes / Aliases.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-12  |  8.3 KB  |  258 lines  |  [TEXT/R*ch]

  1. /*
  2.      File:        Aliases.h
  3.  
  4.      Contains:    Alias Manager Interfaces.
  5.  
  6.      Version:    Technology:    Mac OS 8.1
  7.                  Release:    QuickTime 4.1
  8.  
  9.      Copyright:    (c) 1989-1995, 1997-1999 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __ALIASES__
  18. #define __ALIASES__
  19.  
  20. #ifndef __MACTYPES__
  21.     #include <MacTypes.h>
  22. #endif
  23.  
  24. #ifndef __APPLETALK__
  25.     #include <AppleTalk.h>
  26. #endif
  27.  
  28. #ifndef __FILES__
  29.     #include <Files.h>
  30. #endif
  31.  
  32.  
  33.  
  34.  
  35. #if PRAGMA_ONCE
  36. #pragma once
  37. #endif
  38.  
  39. #ifdef __cplusplus
  40. extern "C" {
  41. #endif
  42.  
  43. #if PRAGMA_IMPORT
  44. #pragma import on
  45. #endif
  46.  
  47. #if PRAGMA_STRUCT_ALIGN
  48.     #pragma options align=mac68k
  49. #elif PRAGMA_STRUCT_PACKPUSH
  50.     #pragma pack(push, 2)
  51. #elif PRAGMA_STRUCT_PACK
  52.     #pragma pack(2)
  53. #endif
  54.  
  55. enum {
  56.     rAliasType                    = FOUR_CHAR_CODE('alis')        /* Aliases are stored as resources of this type */
  57. };
  58.  
  59. enum {
  60.                                                                 /* define alias resolution action rules mask */
  61.     kARMMountVol                = 0x00000001,                    /* mount the volume automatically */
  62.     kARMNoUI                    = 0x00000002,                    /* no user interface allowed during resolution */
  63.     kARMMultVols                = 0x00000008,                    /* search on multiple volumes */
  64.     kARMSearch                    = 0x00000100,                    /* search quickly */
  65.     kARMSearchMore                = 0x00000200,                    /* search further */
  66.     kARMSearchRelFirst            = 0x00000400                    /* search target on a relative path first */
  67. };
  68.  
  69. enum {
  70.                                                                 /* define alias record information types */
  71.     asiZoneName                    = -3,                            /* get zone name */
  72.     asiServerName                = -2,                            /* get server name */
  73.     asiVolumeName                = -1,                            /* get volume name */
  74.     asiAliasName                = 0,                            /* get aliased file/folder/volume name */
  75.     asiParentName                = 1                                /* get parent folder name */
  76. };
  77.  
  78. /* ResolveAliasFileWithMountFlags options */
  79. enum {
  80.     kResolveAliasFileNoUI        = 0x00000001                    /* no user interaction during resolution */
  81. };
  82.  
  83. /* define the alias record that will be the blackbox for the caller */
  84.  
  85. struct AliasRecord {
  86.     OSType                             userType;                    /* appl stored type like creator type */
  87.     unsigned short                     aliasSize;                    /* alias record size in bytes, for appl usage */
  88. };
  89. typedef struct AliasRecord                AliasRecord;
  90.  
  91. typedef AliasRecord *                    AliasPtr;
  92. typedef AliasPtr *                        AliasHandle;
  93. /* alias record information type */
  94. typedef short                             AliasInfoType;
  95. /*  create a new alias between fromFile-target and return alias record handle  */
  96. EXTERN_API( OSErr )
  97. NewAlias                        (const FSSpec *            fromFile, /* can be NULL */
  98.                                  const FSSpec *            target,
  99.                                  AliasHandle *            alias)                                TWOWORDINLINE(0x7002, 0xA823);
  100.  
  101. /* create a minimal new alias for a target and return alias record handle */
  102. EXTERN_API( OSErr )
  103. NewAliasMinimal                    (const FSSpec *            target,
  104.                                  AliasHandle *            alias)                                TWOWORDINLINE(0x7008, 0xA823);
  105.  
  106. /* create a minimal new alias from a target fullpath (optional zone and server name) and return alias record handle  */
  107. EXTERN_API( OSErr )
  108. NewAliasMinimalFromFullPath        (short                     fullPathLength,
  109.                                  const void *            fullPath,
  110.                                  ConstStr32Param         zoneName,
  111.                                  ConstStr31Param         serverName,
  112.                                  AliasHandle *            alias)                                TWOWORDINLINE(0x7009, 0xA823);
  113.  
  114. /* given an alias handle and fromFile, resolve the alias, update the alias record and return aliased filename and wasChanged flag. */
  115. EXTERN_API( OSErr )
  116. ResolveAlias                    (const FSSpec *            fromFile, /* can be NULL */
  117.                                  AliasHandle             alias,
  118.                                  FSSpec *                target,
  119.                                  Boolean *                wasChanged)                            TWOWORDINLINE(0x7003, 0xA823);
  120.  
  121. /* given an alias handle and an index specifying requested alias information type, return the information from alias record as a string. */
  122. EXTERN_API( OSErr )
  123. GetAliasInfo                    (AliasHandle             alias,
  124.                                  AliasInfoType             index,
  125.                                  Str63                     theString)                            TWOWORDINLINE(0x7007, 0xA823);
  126.  
  127.  
  128. EXTERN_API( OSErr )
  129. IsAliasFile                        (const FSSpec *            fileFSSpec,
  130.                                  Boolean *                aliasFileFlag,
  131.                                  Boolean *                folderFlag)                            TWOWORDINLINE(0x702A, 0xA823);
  132.  
  133. EXTERN_API( OSErr )
  134. ResolveAliasWithMountFlags        (const FSSpec *            fromFile,
  135.                                  AliasHandle             alias,
  136.                                  FSSpec *                target,
  137.                                  Boolean *                wasChanged,
  138.                                  unsigned long             mountFlags)                            TWOWORDINLINE(0x702B, 0xA823);
  139.  
  140. /* 
  141.   Given a file spec, return target file spec if input file spec is an alias.
  142.   It resolves the entire alias chain or one step of the chain.  It returns
  143.   info about whether the target is a folder or file; and whether the input
  144.   file spec was an alias or not. 
  145. */
  146. EXTERN_API( OSErr )
  147. ResolveAliasFile                (FSSpec *                theSpec,
  148.                                  Boolean                 resolveAliasChains,
  149.                                  Boolean *                targetIsFolder,
  150.                                  Boolean *                wasAliased)                            TWOWORDINLINE(0x700C, 0xA823);
  151.  
  152.  
  153. EXTERN_API( OSErr )
  154. ResolveAliasFileWithMountFlags    (FSSpec *                theSpec,
  155.                                  Boolean                 resolveAliasChains,
  156.                                  Boolean *                targetIsFolder,
  157.                                  Boolean *                wasAliased,
  158.                                  unsigned long             mountFlags)                            TWOWORDINLINE(0x7029, 0xA823);
  159.  
  160. EXTERN_API( OSErr )
  161. FollowFinderAlias                (ConstFSSpecPtr         fromFile,
  162.                                  AliasHandle             alias,
  163.                                  Boolean                 logon,
  164.                                  FSSpec *                target,
  165.                                  Boolean *                wasChanged)                            TWOWORDINLINE(0x700F, 0xA823);
  166.  
  167. /* 
  168.    Low Level Routines 
  169. */
  170. /* given a fromFile-target pair and an alias handle, update the lias record pointed to by alias handle to represent target as the new alias. */
  171. EXTERN_API( OSErr )
  172. UpdateAlias                        (const FSSpec *            fromFile, /* can be NULL */
  173.                                  const FSSpec *            target,
  174.                                  AliasHandle             alias,
  175.                                  Boolean *                wasChanged)                            TWOWORDINLINE(0x7006, 0xA823);
  176.  
  177.  
  178. typedef CALLBACK_API( Boolean , AliasFilterProcPtr )(CInfoPBPtr cpbPtr, Boolean *quitFlag, Ptr myDataPtr);
  179. typedef STACK_UPP_TYPE(AliasFilterProcPtr)                         AliasFilterUPP;
  180. #if OPAQUE_UPP_TYPES
  181.     EXTERN_API(AliasFilterUPP)
  182.     NewAliasFilterUPP               (AliasFilterProcPtr        userRoutine);
  183.  
  184.     EXTERN_API(void)
  185.     DisposeAliasFilterUPP           (AliasFilterUPP            userUPP);
  186.  
  187.     EXTERN_API(Boolean)
  188.     InvokeAliasFilterUPP           (CInfoPBPtr                cpbPtr,
  189.                                     Boolean *                quitFlag,
  190.                                     Ptr                        myDataPtr,
  191.                                     AliasFilterUPP            userUPP);
  192.  
  193. #else
  194.     enum { uppAliasFilterProcInfo = 0x00000FD0 };                     /* pascal 1_byte Func(4_bytes, 4_bytes, 4_bytes) */
  195.     #define NewAliasFilterUPP(userRoutine)                             (AliasFilterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppAliasFilterProcInfo, GetCurrentArchitecture())
  196.     #define DisposeAliasFilterUPP(userUPP)                             DisposeRoutineDescriptor(userUPP)
  197.     #define InvokeAliasFilterUPP(cpbPtr, quitFlag, myDataPtr, userUPP)  (Boolean)CALL_THREE_PARAMETER_UPP((userUPP), uppAliasFilterProcInfo, (cpbPtr), (quitFlag), (myDataPtr))
  198. #endif
  199. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  200. #define NewAliasFilterProc(userRoutine)                         NewAliasFilterUPP(userRoutine)
  201. #define CallAliasFilterProc(userRoutine, cpbPtr, quitFlag, myDataPtr) InvokeAliasFilterUPP(cpbPtr, quitFlag, myDataPtr, userRoutine)
  202.  
  203. /*  Given an alias handle and fromFile, match the alias and return aliased filename(s) and needsUpdate flag */
  204. EXTERN_API( OSErr )
  205. MatchAlias                        (const FSSpec *            fromFile, /* can be NULL */
  206.                                  unsigned long             rulesMask,
  207.                                  AliasHandle             alias,
  208.                                  short *                aliasCount,
  209.                                  FSSpecArrayPtr         aliasList,
  210.                                  Boolean *                needsUpdate,
  211.                                  AliasFilterUPP         aliasFilter,
  212.                                  void *                    yourDataPtr)                        TWOWORDINLINE(0x7005, 0xA823);
  213.  
  214.  
  215.  
  216. /* The follow two calls are for Carbon only.  They allow tools and background apps to have
  217.     AliasMgr functionality without ever having to deal with UI */
  218. EXTERN_API( OSErr )
  219. ResolveAliasFileWithMountFlagsNoUI (FSSpec *            theSpec,
  220.                                  Boolean                 resolveAliasChains,
  221.                                  Boolean *                targetIsFolder,
  222.                                  Boolean *                wasAliased,
  223.                                  unsigned long             mountFlags);
  224.  
  225. EXTERN_API( OSErr )
  226. MatchAliasNoUI                    (const FSSpec *            fromFile, /* can be NULL */
  227.                                  unsigned long             rulesMask,
  228.                                  AliasHandle             alias,
  229.                                  short *                aliasCount,
  230.                                  FSSpecArrayPtr         aliasList,
  231.                                  Boolean *                needsUpdate,
  232.                                  AliasFilterUPP         aliasFilter,
  233.                                  void *                    yourDataPtr);
  234.  
  235.  
  236.  
  237.  
  238. #if PRAGMA_STRUCT_ALIGN
  239.     #pragma options align=reset
  240. #elif PRAGMA_STRUCT_PACKPUSH
  241.     #pragma pack(pop)
  242. #elif PRAGMA_STRUCT_PACK
  243.     #pragma pack()
  244. #endif
  245.  
  246. #ifdef PRAGMA_IMPORT_OFF
  247. #pragma import off
  248. #elif PRAGMA_IMPORT
  249. #pragma import reset
  250. #endif
  251.  
  252. #ifdef __cplusplus
  253. }
  254. #endif
  255.  
  256. #endif /* __ALIASES__ */
  257.  
  258.